<?php
header("Content-Type: text/plain");
function retrievePost($uri, $params){
  $param;  
  print_r($params);
  foreach($params as $key=>$value){
    $param  .= $key.'='.$value.'&';
  }
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $uri);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
  $result = curl_exec($ch);
  curl_close($ch);
  return $result;
}


//Validate data
$serviceUri = 'http://onto.rpi.edu/iw2api/pmlvalidator'; //'http://onto.rpi.edu/iw2api/pmlvalidator';
$param2 = array('output' => urlencode('xml'),
                'inputTextRdfSyntax' => urlencode('RX'),
                'inputText' => urlencode($rdfxml));

$result = retrievePost($serviceUri, $param2);

print $serviceUri."\n\n";
print_r($param2);
echo "\nRESULTS\n";
echo $result;
?>
